//
//  WYMessageCell.m
//  CirclePush
//
//  Created by admin on 2018/4/17.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYMessageCell.h"
@interface WYMessageCell()

@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
@property (strong, nonatomic) IBOutlet UILabel *messageTitleLabel;


@property (strong, nonatomic) IBOutlet UILabel *contentLabel;



@end
@implementation WYMessageCell

-(void)setModel:(WYMessageModel *)model
{
    _model = model;
    
    self.timeLabel.text = [self getDate:model.createTime WithDate:@"yyyy-MM-dd"];
    self.contentLabel.text = model.message;
    self.messageTitleLabel.text = model.messageTitle;
    [self.messageImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil];
//    [self.messageImageView sd_setImageWithURL:[NSURL URLWithString:model.image] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
//
//        self.height.constant = image.size.width/image.size.height*(kScreenWidth-16);
//    }];
   
    
    
    
    
}
-(NSString *)getDate:(NSString *)timeStampString WithDate:(NSString *)formater
{
    //@"yyyy-MM-dd HH:mm:ss"
    NSTimeInterval interval    =[timeStampString doubleValue] / 1000.0;
    NSDate *date               = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:formater];
    return [formatter stringFromDate:date];
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
